<%--
  Created by IntelliJ IDEA.
  User: wjc
  Date: 2021/4/7
  Time: 20:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- 引入 Bootstrap -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (Bootstrap 的 JavaScript 插件需要引入 jQuery) -->
    <script src="https://code.jquery.com/jquery.js"></script>
    <title>橡树科技－JavaDemoSystem</title>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global.css" tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global_color.css" tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/styles/global_color.css"/>
    <script language="javascript" type="text/javascript">
            $(document).ready(function(){
                $("input[name='adminCode']").blur(function(){
                    var adminCode = this.value;
                    var data = {"adminCode":adminCode};
                    $.ajax({
                        url:'${pageContext.request.contextPath}/admin/check',
                        type:'GET',
                        contentType:"application/x-www-form-urlencoded",
                        data:data,
                        success:function(ret){
                            if(ret.code == 0){
                                $("#adminCodeCheck").attr("style","color:green");
                            }else {
                                $("#adminCodeCheck").attr("style","color:red");
                                $("input[name='adminCode']").focus();
                            }
                            $("#adminCodeCheck").text(ret.message);
                        }
                    });
                });
            });




        //保存成功的提示消息
        function showResult() {
            showResultDiv(true);
            window.setTimeout("showResultDiv(false);", 3000);
        }
        function showResultDiv(flag) {
            var divResult = document.getElementById("save_result_info");
            if (flag)
                divResult.style.display = "block";
            else
                divResult.style.display = "none";
        }

    </script>
</head>
<body>

<div id="header">
    <img src="/static/images/logo.png" tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/images/logo.png" alt="logo" class="left"/>
    <a href="/logout">[退出]</a>
</div>


<div id="navi">
    <ul id="menu">
        <li><a href="${pageContext.request.contextPath}/index" class="index_on"></a></li>
        <c:forEach items="${list}" var="c">
            <li><a href="${pageContext.request.contextPath}/${c.url}" class="index_on"></a></li>
        </c:forEach>
        <li><a href="user/user_info.html" class="information_off"></a></li>
        <li><a href="user/user_modi_pwd.html"  class="password_off"></a></li>
    </ul>
</div>


<div id="main">
    <div id="save_result_info" class="save_success">保存成功！</div>
    <form action="/admin/admin_add" method="post" class="main_form">
        <div class="text_info clearfix"><span>姓名：</span></div>
        <div class="input_info">
            <input type="text" name="name"/>
            <span class="required">*</span>
            <div class="validate_msg_long">20长度以内的汉字、字母、数字的组合</div>
        </div>
        <div class="text_info clearfix"><span>管理员账号：</span></div>
        <div class="input_info">
            <input type="text" name="adminCode"/>
            <span class="required">*</span><span id="adminCodeCheck" ></span>
            <div class="validate_msg_long" display="inline">30长度以内的字母、数字和下划线的组合</div>
        </div>
        <div class="text_info clearfix"><span>密码：</span></div>
        <div class="input_info">
            <input type="password" name="password"/>
            <span class="required">*</span>
            <div class="validate_msg_long ">30长度以内的字母、数字和下划线的组合</div>
        </div>
        <div class="text_info clearfix" ><span>重复密码：</span></div>
        <div class="input_info">
            <input type="password" name="rePassword"/>
            <span class="required">*</span>
            <div class="validate_msg_long ">两次密码必须相同</div>
        </div>
        <div class="text_info clearfix"><span>电话：</span></div>
        <div class="input_info">
            <input type="text" class="width200" name="telPhone"/>
            <span class="required">*</span>
            <div class="validate_msg_medium ">正确的电话号码格式：手机或固话</div>
        </div>
        <div class="text_info clearfix"><span>Email：</span></div>
        <div class="input_info">
            <input type="text" class="width200" name="email"/>
            <span class="required">*</span>
            <div class="validate_msg_medium ">50长度以内，正确的 email 格式</div>
        </div>
        <div class="text_info clearfix"><span>角色：</span></div>
        <div class="input_info_high">
            <div class="input_info_scroll">
                <ul>
                    <c:forEach items="${roleInfos}" var="roleInfo">
                        <li>
                            <input type="checkbox" name="roles" value="${roleInfo.roleId}"} />
                                ${roleInfo.name}</li>
                    </c:forEach>
                </ul>
            </div>
            <span class="required">*</span>
            <div class="validate_msg_tiny ">至少选择一个</div>
        </div>
        <div class="button_info clearfix">
            <input type="submit" value="保存" class="btn_save" onClick="showResult();"/>
            <input type="button" value="取消" class="btn_save" onclick="location.href='/admin/list';"/>
        </div>
    </form>
</div>

<div id="footer">
    <span>[源自橡树的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</span>
    <br/>
    <span>版权所有(C)橡树信息科技有限公司 </span>
</div>
</body>
</html>
